<?php
# TODO
class Module {
	private $name;
	private $view;
	private $info;

	public function __construct ($name) {
		$this->view = $this->name = $name;
	}

	public function setData ($key, $val, $module = false) {
		$mod = $module ? $module : $this->name;

		return SleekPHP::setData($mod, $key, $val);
	}

	public function getData ($key = false, $module = false) {
		$mod = $module ? $module : $this->name;

		return SleekPHP::getData($mod, $key);
	}

	public function getModule ($module) {
		return isset(SleekPHP::$modules[$module]) ? SleekPHP::$modules[$module] : null;
	}

	public function setView ($view) {
		return $this->view = $view;
	}

	public function getView () {
		return $this->view;
	}

	public function getInfo () {
		if ($this->info) {
			return $this->info;
		}

		$className = get_class($this);
		$tmp = explode('_', $className);
		$site = $tmp[0];
		$module = substr($tmp[1], 0, -6);

		return $this->info = getComponentData($module, $site, 'Modules');
	}
}
/*
### Minimum Module ###
Modules/
	Modules/MyModule/
		Modules/MyModule/MyModule.smarty|plain|whatever.php OR MyModuleModule.php

### Maximum Module ###
Modules/
	Modules/MyModule/
		Modules/MyModule/CSS/
			Modules/MyModule/CSS/MyModule.css
			Modules/MyModule/CSS/RequiredjQPlugin.css

		Modules/MyModule/GFX/
			Modules/MyModule/GFX/Icons/
				Modules/MyModule/GFX/Icons/Red.png
				Modules/MyModule/GFX/Icons/Green.png
				Modules/MyModule/GFX/Icons/Blue.png

		Modules/MyModule/JS/
			Modules/MyModule/JS/MyModule.js
			Modules/MyModule/JS/RequiredjQPlugin.js

		Modules/MyModule/Lang/
			Modules/MyModule/Lang/en.php
			Modules/MyModule/Lang/es.php

		Modules/MyModule/Config.php
		Modules/MyModule/BeforeMyModule.tpl.php
		Modules/MyModule/MyModule.tpl.php
		Modules/MyModule/AfterMyModule.tpl.php
		Modules/MyModule/MyModuleAdmin.php
		Modules/MyModule/MyModuleSU.php
		Modules/MyModule/Error.tpl.php
		Modules/MyModule/MyModuleModule.php
*/
